package com.henu.art.service.Imlp;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.henu.art.annotation.IgnoreToken;
import com.henu.art.entity.Teacher;

import com.henu.art.mapper.TeacherMapper;
import com.henu.art.service.TeacherService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@IgnoreToken
public class TeacherServiceImpl extends ServiceImpl<TeacherMapper,Teacher> implements TeacherService {

    @Resource
    private TeacherMapper mapper;

    @Override
    public List<Teacher> selectById(int id) {
        List<Teacher> teacher = (List<Teacher>) mapper.selectById(id);
        return teacher;
    }
    @Override
    public IPage<Teacher> getTeacherPage(int pageNum,int pageSize){
        Page<Teacher> page = new Page<>(pageNum, pageSize);
        return mapper.selectPage(page, null);
    }

    @Override
    public int insert(Teacher teacher) {
        return mapper.insert(teacher);
    }

    @Override
    public int delete(int id) {
        return mapper.deleteById(id);
    }

    @Override
    public boolean updateById(Teacher teacher) {
        return mapper.updateById(teacher)>0 ;
    }
}
